package com.foreverwin.jzymes.common.service.impl;

import com.foreverwin.jzymes.common.mapper.SiteAdviceMapper;
import com.foreverwin.jzymes.common.service.ISiteAdviceService;
import com.foreverwin.jzymes.framework.util.I18nUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.Map;

@Service
public class SiteAdviceServiceImpl implements ISiteAdviceService {

    @Autowired
    private SiteAdviceMapper siteAdviceMapper;

    /**
     * 检查站点是否存在
     *
     * @param site
     * @return
     */
    public Map<String, Object> existSite( String site ) {
        Assert.hasText( site, I18nUtil.getI18nText( "common.siteNotBlank" ) );
        Map<String,Object> siteMap = siteAdviceMapper.selectSiteMap( site );
        Assert.notNull( siteMap, I18nUtil.getI18nText( "common.siteNotExist", new String[]{ site } ));
        return siteMap;
    }

}
